#include "DisplayManager.h"
#include <stdio.h>
#include <vector>
#include <cstdlib>
//trying something else
#include "includes.h"

// comment if you don't run windows otherwise uncomment
//#define WINDOWS


CDisplayManager::CDisplayManager()
{
}

CDisplayManager::~CDisplayManager()
{
}

void CDisplayManager::drawMapPortion(CObjectManager objman)
{
	//get a more modular map that supports width and height
	//in fact, map may now be redone fine.
	int i = 0;
	int size = objman.m_mapMap.getHeight() * objman.m_mapMap.getWidth();
	char c[size];
	while(i < size)
	{
		if(i == (objman.m_nPlayerY * objman.m_mapMap.getWidth()
			+ objman.m_nPlayerX))
		{
			c[i++] = '@';
		}
		else
		{
			c[i] = (char)objman.m_mapMap.getSymbol(i++);
        	//c[i] = (char)objman.map[i++];    
		}        
		printf("%c", c[i-1]);
	}
	return;
}

void CDisplayManager::clearScreen()
{
	#ifdef WINDOWS
		std::system ( "CLS" );
	#else
		// Assume POSIX
		std::system ( "clear" );
	#endif
	return;
}
